<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Pagelink extends CI_Pagination{
    private $kind = '/0';
    private $count = '';
    private $limit = '';
    private $controller = '';
    private $funcName = '';
    public function __construct(){
        parent::__construct();
    }
    public function __get($property_name){
        if(isset($this->$property_name)){
            return $this->$property_name;
        }
        return null;
    }
    public function __set($property_name,$value){
        $this->$property_name = $value;
    }

    public function createLink(){

        $this->base_url = base_url($this->controller).'/'.$this->funcName.$this->kind;
        $this->uri_segment = 4;
        $this->total_rows = $this->count;
        $this->per_page = $this->limit;
        $this->first_link = '首页';
        $this->prev_link = '上一页';
        $this->full_tag_open = '<ul>';
        $this->full_tag_close = '</ul>';
        $this->first_tag_open = '<li>';
        $this->first_tag_close = '</li>';
        $this->num_tag_open = '<li>';
        $this->num_tag_close = '</li>';
        $this->last_tag_open = '<li>';
        $this->last_tag_close = '</li>';
        $this->cur_tag_open = '<li class="active"><a href="javascript:void(0)">';
        $this->cur_tag_close = '</a></li>';
        $this->prev_tag_open = '<li>';
        $this->prev_tag_close = '</li>';
        $this->next_tag_open = '<li>';
        $this->next_tag_close = '</li>';
        $this->next_link = '下一页';
        $this->last_link = '尾页';
        $this->use_page_numbers = TRUE;
        return $this->create_links();
    }
}